<template>
  <footer class="footer">
    <span class="todo-count" v-if="shenyu"
      ><strong>{{ jisuan }}</strong
      >剩余</span
    >
    <ul class="filters">
      <li>
        <a :class="{selected:type==='a'}" href="#/" @click="gaoliang('a')">全部</a>
      </li>
      <li>
        <a :class="{selected:type==='aa'}" href="#/active" @click="gaoliang('aa')">进行中</a>
      </li>
      <li>
        <a :class="{selected:type==='aaa'}" href="#/completed" @click="gaoliang('aaa')">已完成</a>
      </li>
    </ul>
    <button class="clear-completed" @click="qing" v-if="qingchu">清除已完成</button>
  </footer>
</template>

<script>
export default {
  name: 'HmFoot',
  props: {
    list: {
      type: Array,
      required: true
    },
    type:{
         type: String,
      required: true
    }
  },
  components: {},
  data () {
    return {}
  },
  methods: {
    qing () {
      this.$emit('qing')
    },
    gaoliang(id){
        this.$emit('gaoliang',id)
    }
   
  },
  computed: {
    jisuan () {
      const res = this.list.filter(item => item.isDone === false)
      return res.length
    },
    shenyu(){
      return  this.list.some(item=>item.isDone===false)
    },
    qingchu(){
     return  this.list.some(item=>item.isDone===true)
    },
  }
}
</script>

<style scoped lang="less"></style>
